<table class="category">
	<tr>
		<td class="categorybody">
			<div id="flaps">
				<?php
				if (isset($_SERVER['HTTP_USER_AGENT']) && $server->bot_detect($_SERVER['HTTP_USER_AGENT'])) {
					include($server->get_path_name('shop_flaps.php'));
				}
				?>
			</div>
			<div id="containerProducts">
				<?php
				if (isset($_SERVER['HTTP_USER_AGENT']) && $server->bot_detect($_SERVER['HTTP_USER_AGENT'])) {
					include($server->get_path_name('shop_content.php'));
				}
				?>
			</div>
		</td>
	</tr>
</table>
<script type="text/javascript">
var categoryId=null;
var catalogPointer=myCatalog;
catalogPointer=catalogPointer.moveToChildren("selected");
//two posibilities: it has subcategories or it hasn't
if (catalogPointer.items.length) {
	//it has no subcategories
	document.getElementById("flaps").innterHTML="";
	var shopContentHref="?section=shop_content&category_id=" + catalogPointer.myCategory.id;
	setViewTo( shopContentHref ,'rightContentBox:containerProducts');
	//It also could be refreshItemsListView("containerProducts") instead setViewTo
}
else {
	// it could have subcategories
	if (catalogPointer.children.length > 0) {
		catalogPointer.refreshCategoriesListView("flaps");
		//We search for items. It should have been loaded in advance by shop_flaps.php
		catalogPointer=catalogPointer.moveToChildren("selected");
		var shopContentHref="?section=shop_content&category_id=" + catalogPointer.myCategory.id;
		setViewTo( shopContentHref ,'rightContentBox:containerProducts');
	}
	else {
		var shopFlapsHref="?section=shop_flaps&category_id=" + catalogPointer.myCategory.id;
		setViewTo(shopFlapsHref,'rightContentBox:flaps');
	}
}
</script>